package com.gxa.order.controller.hotel;

import com.gxa.common.commons.R;
import com.gxa.order.pojo.hotel.RoomType;
import com.gxa.order.service.RoomTypeService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/roomType")
public class RoomTypeController {
    @Resource
    private RoomTypeService roomTypeService;

    /**
     * 添加房间类型
     * @param roomType
     * @return
     */
    @PostMapping(value = "/addRoomType")
    public R addRoomType(@RequestBody RoomType roomType){
        return roomTypeService.addRoomType(roomType);
    }

    /**
     * 查询房间类型不做分页（是否可预约）
     * @param roomTypeId
     * @return
     */
    @GetMapping(value = "/queryRoomType")
    public R queryRoomType(@Param(value = "hotelId") Integer hotelId, @Param(value = "roomTypeId") Integer roomTypeId){
        return roomTypeService.queryRoomType(hotelId,roomTypeId);
    }

    /**
     * 修改房间类型
     * @param roomType
     * @return
     */
    @PostMapping(value = "/updateRoomType")
    public R updateRoomType(@RequestBody RoomType roomType){
        return roomTypeService.updateRoomType(roomType);
    }

    /**
     * 上下架房间类型
     * @param roomTypeId
     * @return
     */
    @GetMapping(value = "/downRoomType")
    public R downRoomType(Integer roomTypeId){
        return roomTypeService.downRoomType(roomTypeId);
    }



}
